perm filename HALFDO.MF[UHF,DEK] blob
sn#841757 filedate 1987-06-16 generic text, type T, neo UTF8
% halftone font with 17 levels of gray, characters "A" (white) to "Q" (black)
% includes also mirror-image characters, characters "a" (white) to "q" (black)
% based on idea of Robert L. Gard, Comp Graphics and Image Proc 5 (1976) p156
pair p[]; % the pixels in order (first p0 becomes black, then p1, etc)
p0=(3,0);
p4=(2,0);
p8=(2,2);
p12=(3,2);
transform r; r=identity rotatedaround ((1.5,1.5),180);
for i=0 step 4 until 12:
p[i+1]=p[i] transformed r;
p[i+2]=p[i] shifted (0,1);
p[i+3]=p[i+2] transformed r;
endfor
w#:=4/pt; % that's 4 pixels
font_quad:=w#; designsize:=8w#;
r:=identity reflectedabout ((2,0),(2,3));
picture prevchar; prevchar=nullpicture; % the pixels blackened so far
for i=0 upto 16:
beginchar(i+ASCII"A",w#,w#,0); currentpicture:=prevchar;
if i>0: addto currentpicture also unitpixel shifted p[i-1]; fi
prevchar:=currentpicture; endchar;
beginchar(i+ASCII"a",w#,w#,0);
currentpicture:=prevchar transformed r; endchar;
endfor